<template>
	<view class="item" @click="toDetail">
		<view class="title">
			<text class="my-text name">{{props.item.name}}</text><text class="title-text">{{props.item.sellPrice}}元</text>
		</view>
		<view class="address">
			{{props.item.addr}}
		</view>
		<view class="tags">
			<view class="tag"
				:style="`border-color:${(tag.name=='小吃')||(tag.name=='折扣卡')?'var(--yellow)':'var(--blue)'};color:${(tag.name=='小吃')||(tag.name=='折扣卡')?'var(--yellow)':'var(--blue)'}`"
				v-for="(tag,index) in props.item.labels" :key="index">
				{{tag.name}}
			</view>
		</view>
		<view class="show-time">
			{{props.item.showTimes}}
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from "vue"
	const props = defineProps(['item']);
	const emit = defineEmits(['toDetail'])
	// console.log(props.item);
	const  toDetail = ()=>{
		emit('toDetail',props.item);
	}
</script>

<style lang="scss" scoped>
	.item {
		width: 100%;
		box-sizing: border-box;
		padding: 20rpx 0;
		font-size: 30rpx;

		>view {
			margin-bottom: 10rpx;
		}

		.title {
			font-size: 34rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			.title-text {
				min-width: 180rpx;
				color: var(--red);
				line-height: 34rpx;
				text-align: right;
			}

			.small {
				font-size: 26rpx;
				line-height: 26rpx;
			}
		}

		.address {
			font-size: 28rpx;
			color: var(--gray);
		}

		.tags {
			width: 100%;
			display: flex;
			flex-wrap: wrap;

			.tag {
				font-size: 24rpx;
				padding: 2rpx 10rpx;
				border-radius: 4rpx;
				border: 2rpx solid var(--blue);
				margin-right: 10rpx;
				margin-bottom: 10rpx;
			}
		}
		.show-time{
			color: var(--gray);
		}
	}
</style>